#include "Rain.h"

Rain::Rain()
{
	for (int i = 0; i < 100; ++i)
	{
		_rain[i].x = rand() % WindowWidth;
		_rain[i].y = rand() % WindowHeight;
	}
}

void Rain::Draw(HDC hdc)
{
	HPEN hpenWhite = CreatePen(PS_SOLID, 1, RGB(255, 255, 255));
	HPEN hpen = (HPEN)SelectObject(hdc, hpenWhite);

	for (int i = 0; i < 100; ++i)
	{
		MoveToEx(hdc, _rain[i].x, _rain[i].y, NULL);
		LineTo(hdc, _rain[i].x, _rain[i].y + 10);

		_rain[i].y += rand() % 10;
		if (_rain[i].y >= WindowHeight)
			_rain[i].y = 0;
	}

	SelectObject(hdc, hpen);
	DeleteObject(hpenWhite);
}
